package com.atguigu.userprofile.common.dao;

import com.atguigu.userprofile.common.bean.TagInfo;
import com.atguigu.userprofile.common.util.MySQLUtil;

import javax.swing.text.html.HTML;
import java.util.List;

public class TagInfoDAO {


    /**
     * 根据taskId查询tag
     * @param taskId
     * @return
     */
    public static  TagInfo getTagInfoByTaskId(String taskId){
        String tagSQL="select * from tag_info where tag_task_id= "+taskId;
        TagInfo tagInfo = MySQLUtil.queryOne(tagSQL, TagInfo.class, true);
        return tagInfo;
    }

    /**
     * 查询所有启用状态的标签
     * @return
     */
    public  static List<TagInfo> getTagInfoListWithOn(){
        String sql="  select ti.* from tag_info ti join task_info tk on ti.tag_task_id= tk.id  where  tk.task_status='1'   ";
        List<TagInfo> tagInfoList = MySQLUtil.queryList(sql, TagInfo.class, true);
        return tagInfoList;
    }
}
